# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity_study_code
File Name: database64.py
Author: kij
Create Date: 2021/9/3
-------------------------------------------------
"""

import time
import execjs

import os
import re

def get_js():
    # 读文件
    # 1.获取当前文件 读文件操作.py 的路径
    abs = os.path.abspath(__file__)
    # 找到上级目录 dirname
    path = os.path.dirname(abs)
    base_dir = os.path.dirname(os.path.abspath(__file__))
    # 路径拼接 ()可以跟多了路径
    file_path = os.path.join(base_dir, "base64.js")
    # 2.判断文件是否存在
    if not os.path.exists(file_path):
        print("文件夹不存在就创建")
    # os.makedirs(file_path)
    else:
        # 字节读取
        file_object = open(file_path, mode='rb')
        data = file_object.read()
        file_object.close()
        text = data.decode('utf-8')
        # 文本读取
        file_text = open(file_path, mode='rt', encoding='utf-8')
        file_message = file_text.read()
        file_text.close()
    return file_message


def get_json_base64(jiami_str:str,now_time:str):

    js_message = get_js()
    ctx = execjs.compile(js_message)

    jm_fpdm = ctx.call("decryptData", jiami_str,now_time)
    return jm_fpdm

if __name__ == "__main__":
    print('开始查验')
    print(time.strftime("%Y-%m-%d %H:%M:%S"))
    data_test = """vyJrZCkxIjliaVZXT1J3NEtHZ79BQUUBTlNEaEVVA0FBQFhnQUUBQXlWQUlBJUFBWChZaVYBQUFKV2tsIVFWUqQydTQiQ1hHTjF4xkhiM9l6aVU6R0pSb2Vhz3BRS7dSUkExSTBsVkZVz0VVapNKR2oDVnBjRFMzEjFLTaYxSkIYVjdMYVNnAlRvMaJxRFV4MXZINjB5Mm9PaCFxcTU6N1YcdFQzwS9saaIvZmNzQ0UaTjJoDHo5b6JhNTp5OTk6bm5QOys5dr83Zjp4NU1zbE0wvS85OHtoZnsiUGxsczlzFTR0SqFaN1YybGFqcVJkGVB2ZUhrVkovUHFzaUxsNXk2SFcva0sVRmJkdWcxLGJmODNleTI2ZkN7N29UGU0zK7JMTlI1RTIaZ0NnGy83dDI0dzJ3UW1dNjhMImZuSVFxSTMsbHREcE5xz1kwR6RaNygXMkJnb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